<?php 
$user=$session->read('User');
?>
<div class="right_side_operate_area">
    <div class="right_side_title left">
        <h2>
        <?php 
        $companyyear=$form->value('CompEconomic.company_year');
        $companyname=$session->read("companyname");
        $companyid=$session->read("companyid");
        echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
        $isflag=$action->checkPermissions($user,$companyid);
        ?>
        </h2>
        <div class='clear'></div>
    </div>
    <style>
    .back_btn a{
        float:left;
    }
    </style>
    <div class="right back_btn" >
        <?php 
            if($user['cid']=='' || empty($user['cid'])){
                if($form->value('CompEconomic.state')=="2"){
                 echo $html->link("通过审核","/companys/change_economic_state/?id=".$form->value('CompEconomic.id').'&state=1');
                }
                if($form->value('CompEconomic.state')=="1"){
                   //  echo $html->link("驳回提交","/companys/change_economic_state/?id=".$form->value('CompEconomic.id').'&state=2');
                }
                if($form->value('CompEconomic.state')=="0"){
                    echo $html->link("通过审核","/companys/change_economic_state/?cid=".$_SESSION['companyid']."&id=".$form->value('CompEconomic.id').'&state=1');
                    echo $html->link("驳回提交","/companys/change_economic_state/?cid=".$_SESSION['companyid']."&id=".$form->value('CompEconomic.id').'&state=2');
                } 
            }
            
           
            echo $html->link("返回","/companys/economic/".$_SESSION['companyid']);
        ?>
    </div>
    <div class="clear"></div>
</div>

<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="right_side_operate_area" style="display:none">
            <div class="right_side_title left">
                <h3>
                    <?php
                        echo $companyyear.'年企业经济指标';
                    ?>
                </h3>
            </div>
            <div class="clear"></div>
        </div>
        <?php 
        echo $form -> create('CompEconomic', array('url'=>'/companys/showeconomic','enctype'=>'multipart/form-data') ); 
        ?>			
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">年月：</div>
                <div class="form_right_input left">
                    <?php echo $form->value('CompEconomic.company_year');?>年
                    <?php echo $form->value('CompEconomic.month');?>月
                </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">
                 <?php if($form->value('CompEconomic.state')=="1"){?>
                <font color='red'>总收入</font><?php  }else {echo "总收入";}?>：</div>
                <div class="form_right_input left">
                    <?php echo $str->setprice($form->value('CompEconomic.general_income'));?>
                </div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">
                 <?php if($form->value('CompEconomic.state')=="1"){?>
                 <font color='red'><?php echo "净利润";?></font><?php  }else {echo "净利润";}?>：</div>
                <div class="form_right_input left">
                    <?php echo $str->setprice($form->value('CompEconomic.net_profit'));?>
                </div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">
                 <?php if($form->value('CompEconomic.state')=="1"){?>
                 <font color='red'><?php echo "工业总产值";?></font><?php  }else {echo "工业总产值";}?> ：</div>
                <div class="form_right_input left">
                    <?php echo  $str->setprice($form->value('CompEconomic.prospect'));?>
                </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">
                <?php if($form->value('CompEconomic.state')=="1"){?>
                 <font color='red'><?php echo "产品销售额";?></font><?php  }else {echo "产品销售额";}?>：</div>
                <div class="form_right_input left">
                    <?php echo $str->setprice($form->value('CompEconomic.gross_output'));?>
                </div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">
                <?php if($form->value('CompEconomic.state')=="1"){?>
                <font color='red'><?php echo "利税";?></font><?php  }else {echo "利税";}?>：</div>
                <div class="form_right_input left">
                    <?php echo $str->setprice($form->value('CompEconomic.pro_taxe'))?>
                </div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">
                <?php if($form->value('CompEconomic.state')=="1"){?>
                <font color='red'>上缴税金</font><?php  }else {echo "上缴税金";}?>：</div>
                <div class="form_right_input left">
                    <?php echo $str->setprice($form->value('CompEconomic.over_taxes'));?>
                </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">出口创汇：</div>
                <div class="form_right_input left">
                    <?php echo $str->setprice($form->value('CompEconomic.qcll'));?>
                </div>
            </div>
                <div class="details_item">
                    <div class="form_left_title left">减免税指标：</div>
                    <div class="form_right_input left">
                        <?php echo $str->setprice($form->value('CompEconomic.taxindex'));?>
                    </div>
                </div>
                <div class="details_item">
                    <div class="form_left_title left">高企减免税：</div>
                    <div class="form_right_input left">
                        <?php echo $str->setprice($form->value('CompEconomic.tax'));?>
                    </div>
                </div>
            </div>
            <div class="details_item_line">
                <div class="details_item">
                    <div class="form_left_title left">研发费减免税：</div>
                    <div class="form_right_input left">
                        <?php echo $str->setprice($form->value('CompEconomic.devtax'));?>
                    </div>
                </div>
        </div>
        <div class="details_item_line">  
            <div class="details_item">
                <div class="form_left_title left"><?php echo "附件" ;?>：</div>
                <div class="left">
                    <div class="file_category_list">
                        <div id="filelist0" class="file_lists">
                            <?php $dan="'";
                                if($attachments){?>
                            <ul class="picture_attach">
                                <?php
                                foreach($attachments as $attachment){
                                        $fname=$attachment["file_name"];
                                        $fpath=$attachment["file_path"];
                                        $fid=$attachment["id"];
                                        $createdtime=date("Y-m-d",strtotime($attachment["created"]));
                                        $isimg=$str->checkimg($fname);
                                        if($isimg){
                                            echo "<li>";
                                            echo '<div class="picture_info">';
                                            echo "<span>".$fname."</span>";
                                            echo "<span class='source_upload_date'>".$createdtime.$html->link("下载",'/projects/download/'.$attachment["id"],null)."</span>";
                                            echo "</div>";
                                            if($isflag){
                                                echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
                                            }
                                            $img=$html->image("/".$fpath);
                                            echo "<span>".$html->link($img,'javascript:void(0);',array('onclick'=>"openimg(".$dan."f".$fid.$dan.")",'escape' => false))."</span>";
                                            echo "<div style='display:none' id='f".$fid."' title='".$fname."'>".$img."</div>";
                                            
                                            echo "</li>";
                                        }
                                    }
                                ?>
                                <div class="clear"></div>
                            </ul>
                            <ul class="file_attach">
                                <?php
                                foreach($attachments as $attachment){
                                        $fname=$attachment["file_name"];
                                        $isimg=$str->checkimg($fname);
                                        if(!$isimg){
                                            echo "<li>";
                                            echo "<span>".$html->link($fname,'/projects/download/'.$attachment["id"],null)."</span>";
                                            echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
                                            if($isflag){
                                                echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
                                            }
                                            echo "</li>";
                                        }
                                    }
                                ?>
                                <div class="clear"></div>
                            </ul>
                            <?php 
                                }else{
                                    echo '<div class="form_right_input left">暂无文件</div>';
                                }
                            ?>
                        </div>
                     </div>
                </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">审核状态：</div>
                <div class="form_right_input left">
                 <?php if($form->value('CompEconomic.state')=="1"){?>
                   <b><font color='green' size='3'>   <?php
                      echo "审核通过";?></font></b>
                <?php  }else if($form->value('CompEconomic.state')=="0"){
                echo '<b>';
                echo '<font color=red size=3 weight=bold>';
                echo "审核中";
                echo '</font>';
                echo '</b>';
                }else if($form->value('CompEconomic.state')=="2"){
                    echo '<b>';
                    echo '<font color=black size=3 weight=bold>';
                    echo "被驳回";
                    echo '</font>';
                    echo '</b>';  
                }else{
                	 echo '<b>';
                    echo '<font color=black size=3 weight=bold>';
                    echo "等待";
                    echo '</font>';
                    echo '</b>';  
                }?>
                </div>
            </div>
        </div>
        </form>

        <div class="right_side_operate_area"  style="display:none">
            <div class="right_side_title left">
                <h3>
                    <div><?php echo $companyyear?>年企业融资情况</div>			
                </h3>
            </div>
            <div class="right back_btn">
                <?php 
                echo $html->link("编辑融资","/companys/financ/");	
                ?>
            </div>
            <div class="clear"></div>
        </div>
        <div class="items_list" style="display:none">	
            <table>
                <tr>
                    <th>融资渠道</th>
                    <th>金额（￥）</th>
                    <th>融资时间</th>
                    <th>财务报表</th>				
                    <th>&nbsp;</th>
                </tr>
            <?php 
                if(!empty($comp_financs)){
                    foreach ($comp_financs as $comp_financ)
                    {
                        $id=$comp_financ["CompFinanc"]["id"];
                        echo "<tr class='per_list'>";
                        $fin_channels=$comp_financ['CompFinanc']['fin_channels'];
                        echo "<td><span title='".$fin_channels."'>".$str->sub_len($fin_channels,20)."</span></td>";
                        echo "<td>".$comp_financ['CompFinanc']['money']."</td>";
                        $fin_time=$comp_financ['CompFinanc']['fin_time'];
                        if(!empty($fin_time)){
                            $fin_time=date("Y-m-d",strtotime($fin_time));
                        }
                        echo "<td>".$fin_time."</td>";	
                        echo "<td>";
                                $attachments=$comp_financ['Attachment'];
                                if($attachments){
                                    $dan="'";
                                    $second_ownerid=$form->value('Company.second_owner');
                                    foreach($attachments as $attachment) {
                                            echo "<li>";
                                            echo "<span>".$html->link($attachment["file_name"],'/projects/download/'.$attachment["id"],null)."</span>";
                                            echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
                                            if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id']){
                                                echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
                                            }
                                            echo "</li>";
                                    }
                                }else{
                                    echo "暂无文件";
                                }
                                
                         echo "</td>";										
                        echo "</tr>";
                    }
                }
            ?>
            </table>
        </div>
        </div>
    </div>
</div>
<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
<?php echo $javascript->link('project.js');?>